﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class VideoPlayerUI : MonoBehaviour {

    private static VideoPlayerUI instance = null;
    public static VideoPlayerUI GetInstance()
    { return instance; }

    public GameObject menu = null;

    public GameObject btnPause = null;

    public GameObject uiOpenAfterClose = null;

    public void OnReturn()
    {
        VideoBG.Close();
        gameObject.SetActive(false);

        uiOpenAfterClose.SetActive(true);
    }

    public void OnReplay()
    {
        VideoBG.Replay();
    }

    public void OnBtnBg()
    {
        menu.SetActive(!menu.activeSelf);
    }

    public void OnBtnPause()
    {
        btnPause.SetActive(false);
        VideoBG.Pause();
    }

    
    public void OnBtnPlay()
    {
        btnPause.SetActive(true);
        VideoBG.Play();
    }


    private void Awake()
    {
        instance = this;
    }

    // Use this for initialization
    void Start () {
        gameObject.SetActive(false);
	}

    public void _Open(GameObject uiBk, bool closeUIBK = true )
    {
        btnPause.SetActive(true);
        uiOpenAfterClose = uiBk;
        uiBk.SetActive(false);
        gameObject.SetActive(true);
        menu.SetActive(false);
    }
	
    public static void Open( GameObject uiBk, bool closeUIBK=true )
    {
        instance._Open(uiBk, closeUIBK);

    }
}
